<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title>add-contact</title>
	<link rel="stylesheet" href="../css/bootstrap.min.css" />
	<link rel="stylesheet" href="../css/style.css" />
</head>
<body>
	<div class="container">
		<!--header start-->
		<div class="header">
			<%@ include file="include/top.jsp" %>
		</div>
		<!--header end-->
		<div class="content">
			<div class="row">
				<div class="span9">
					<div class="list">
						<span><i class="icon-hand-right"></i>添加联系人</span>
					</div>
					<div class="newproduct">
						<form class="form-horizontal" action="addcontact.jspx" method="post" id="fm" autocomplete="off">
							<div class="control-group">
								<label class="control-label">姓名</label>
								<div class="controls">
									<input type="text" id="name" name="name" class="span5 required">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">公司</label>
								<div class="controls">
									<input type="text" id="companyName" name="companyName" class="span5 required">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">手机</label>
								<div class="controls">
									<input type="text" id="mobile" name="mobile" class="span5 required">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">固话</label>
								<div class="controls">
									<input type="text" id="tel" name="tel" class="span5 required">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">邮箱</label>
								<div class="controls">
									<input type="text" id="email" name="email" class="span5 required email">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">地址</label>
								<div class="controls">
									<input type="text" id="address" name="address" class="span5 required">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">主页</label>
								<div class="controls">
									<input type="text" id="website" name="website" class="span5 required url">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">微博</label>
								<div class="controls">
									<!--<select class="span2">
										  <option>----</option>
										  <option value="0">新浪微博</option>
										  <option value="1">腾讯微博</option>
										  <option value="2">Twitter</option>
									</select>
									-->
									<div class="input-prepend">
										  <span class="add-on">@</span>
										  <input class="span2 required" id="weibo" name="weibo" type="text">
									</div>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="inputPassword">简介</label>
								<div class="controls">
									<textarea rows="3"  class="span5" id="desc" name="desc"></textarea>
								</div>
							</div>
							<div class="form-actions">
								<button type="submit" class="btn btn-primary" id="addcontactbtn">保存</button>
								<a href="contact.jspx" class="btn">返回</a>
							</div>
						</form>
					</div>
				</div>
				<div class="span3"></div>
			</div>
		</div>
		<%@ include file="include/footer.jsp" %>
	</div>
	<script type="text/javascript" src="../js/jquery.js"></script>
	<script type="text/javascript" src="../js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="../js/messages_zh.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			//手机验证方法
			jQuery.validator.addMethod("mobile", function(value, element) { 
				  var length = value.length; 
				  var mobile =/^((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))\d{8}$/;
				  return this.optional(element) || (mobile.test(value)); 
				}, "请填写正确的电话号码"); 
			//固话验证方法
			jQuery.validator.addMethod("tel", function(value, element) { 
				  var length = value.length; 
				  var tel = /^\d{3,4}-?\d{7,8}$/;
				  return this.optional(element) || ( tel.test(value)); 
				}, "请填写正确的电话，格式：010-12345678"); 
				
			//进行验证
			$("#fm").validate({
				rules:{
					mobile:{mobile:true},
					tel:{tel:true}
			}});
			
		});;
	</script>
</body>
</html>